package VLine

import "fmt"


type Token struct {
	category int
	value    string
	spacing  bool
	line     int
}

func TokenNew(category int, value string, spacing bool, line int) *Token {
	return &Token{category, value, spacing, line}
}

func (token *Token) String() string {
	var category string
	switch token.category {
	case TOKEN_ID:
		category = "TOKEN_ID"
	case TOKEN_STRING:
		category = "TOKEN_STRING"
	case TOKEN_NUMBER:
		category = "TOKEN_NUMBER"
	case TOKEN_ADD:
		category = "TOKEN_ADD"
	case TOKEN_SUB:
		category = "TOKEN_SUB"
	case TOKEN_MUL:
		category = "TOKEN_MUL"
	case TOKEN_DIV:
		category = "TOKEN_DIV"
	case TOKEN_MOD:
		category = "TOKEN_MOD"
	case TOKEN_POS:
		category = "TOKEN_POS"
	case TOKEN_NEG:
		category = "TOKEN_NEG"
	case TOKEN_POWER:
		category = "TOKEN_POWER"
	case TOKEN_LEFTPARENTHESIS:
		category = "TOKEN_LEFTPARENTHESIS"
	case TOKEN_RIGHTPARENTHESIS:
		category = "TOKEN_RIGHTPARENTHESIS"
	case TOKEN_LEFTBRACKET:
		category = "TOKEN_LEFTBRACKET"
	case TOKEN_RIGHTBRACKET:
		category = "TOKEN_RIGHTBRACKET"
	case TOKEN_LEFTBRACE:
		category = "TOKEN_LEFTBRACE"
	case TOKEN_RIGHTBRACE:
		category = "TOKEN_RIGHTBRACE"
	case TOKEN_ASSIGN:
		category = "TOKEN_ASSIGN"
	case TOKEN_SEMICOLON:
		category = "TOKEN_SEMICOLON"
	case TOKEN_COMMA:
		category = "TOKEN_COMMA"
	case TOKEN_POINT:
		category = "TOKEN_POINT"
	case TOKEN_CONCAT:
		category = "TOKEN_CONCAT"
	case TOKEN_EQUAL:
		category = "TOKEN_EQUAL"
	case TOKEN_NOTEQUAL:
		category = "TOKEN_NOTEQUAL"
	case TOKEN_LESS:
		category = "TOKEN_LESS"
	case TOKEN_LESSEQUAL:
		category = "TOKEN_LESSEQUAL"
	case TOKEN_GREATER:
		category = "TOKEN_GREATER"
	case TOKEN_GREATEREQUAL:
		category = "TOKEN_GREATEREQUAL"
	case TOKEN_EOF:
		category = "TOKEN_EOF"
	case TOKEN_AND:
		category = "TOKEN_AND"
	case TOKEN_FALSE:
		category = "TOKEN_FALSE"
	case TOKEN_RETURN:
		category = "TOKEN_RETURN"
	case TOKEN_IF:
		category = "TOKEN_IF"
	case TOKEN_LET:
		category = "TOKEN_LET"
	case TOKEN_NIL:
		category = "TOKEN_NIL"
	case TOKEN_NOT:
		category = "TOKEN_NOT"
	case TOKEN_OR:
		category = "TOKEN_OR"
	case TOKEN_TRUE:
		category = "TOKEN_TRUE"
	case TOKEN_FOR:
		category = "TOKEN_FOR"
	case TOKEN_IN:
		category = "TOKEN_IN"
	case TOKEN_FUNCTION:
		category = "TOKEN_FUNCTION"
	case TOKEN_ELSEIF:
		category = "TOKEN_ELSEIF"
	case TOKEN_ELSE:
		category = "TOKEN_ELSE"
	case TOKEN_IMPORT:
		category = "TOKEN_IMPORT"
	case TOKEN_FROM:
		category = "TOKEN_FROM"
	}
	if token.value == "" {
		return fmt.Sprintf("line:%d\tspacing:%v \ttoken:%s \t", token.line, token.spacing, category)
	}
	return fmt.Sprintf("line:%d\tspacing:%v \ttoken:%s \tvalue: %s", token.line, token.spacing, category, token.value)
}
